
import mysql.connector as mc

class Py_db_con():
    def PY_db(self,*args):
        print(args)
        try:
            com = mc.connect(
                host=args[1],
                port=args[2],
                user=args[3],
                password=args[4],
                database=args[5],
                charset="utf8"
            )
        except mc.Error as e:
            print("连接失败！！")
        else:
            print("连接成功")

            return com


if __name__ == '__main__':
    py = Py_db_con()
    py.PY_db("127.0.0.1","3306","root","05130422","zuoye")





